package com.xxpt.common.controller;

import com.xxpt.common.annotation.NoAuth;
import com.xxpt.common.BaseController;
import com.xxpt.model.Result;
import com.xxpt.model.user.User;
import com.xxpt.user.feign.AccountFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuyanling
 * @date 2020-04-17 23:35:04
 */
@NoAuth
@RestController
@RequestMapping(value = "/common")
public class UploadController extends BaseController {

    @Autowired
    AccountFeign accountFeign;

    /**
     * 上传文件到OSS
     * @param file
     * @param fileUploadType
     * @Author Liuyanling
     * @return
     */
    /*@RequestMapping("/uploade")
    public Result uploadFileInfo(MultipartFile file, FileUploadType fileUploadType){
        OssUploadUtil.UploadFileInfo uploadFileInfo = OssUploadUtil.upladFile(file, fileUploadType);
        Map<String,Object> info = new MapUtils();
        info.put("data",uploadFileInfo.getUrl());
        info.put("fileName",uploadFileInfo.getOldName());
        return Result.ok(info);
    }*/

    @GetMapping("/test")
    public Result uploadFileInfo(){
        User user = accountFeign.findById(1L);
        return Result.ok(user);
    }
}
